package my.mark.mybaibaoxiang.juc.biji09;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author wxming.
 * @description:
 */
public class ExecutorSample {
    //protected ExecutorService executor = Executors.newFixedThreadPool(2*Runtime.getRuntime().availableProcessors()+1);

    public static void main(String[] args) {
        ExecutorService executor = Executors.newFixedThreadPool(5);
        //ThreadPoolExecutor 这样的线程池类
        for (int i=0;i<20;i++){
            //executor.execute(new RunTask());
            executor.submit(new RunTask());
        }
        //验证线程创建过程比较慢，好资源
        //executor.shutdownNow();//执行该方法进入stop状态
        //executor.execute(new RunTask());
    }

}
